package com.lxq.www.controller;

import com.lxq.www.pojo.Article;
import com.lxq.www.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
public class ArticleController {

    @Autowired
    ArticleService articleService;

    @GetMapping("/article/public_list")
    public ArrayList<Article> getPublicAll(){
        return articleService.getPublicAllForList();
    }

    @GetMapping("/article/{articleId}")
    public Article getById(@PathVariable String articleId){
        return articleService.getById(articleId);
    }
}
